﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _007_继承与多态
{
    public class GrandPa
    {
        private int money = 20000;
        private int house = 2;
        private int car = 3;

        public int GetMoney()
        {
            return money;
        }
        public int GetHouse()
        {
            return house;
        }
        public int GetCar()
        {
            return car;
        }
    }

    public class Uncle : GrandPa
    {
        private int wifeHouse = 1;

        //重写
        public new int GetHouse()
        {
            //base访问父类方法
            return this.wifeHouse + base.GetHouse();
        }
    }

    public class Father : GrandPa
    {

    }

    public class Son : Father
    {

    }

}
